package org.nathanielyoung.events;

import java.util.ArrayList;
import java.util.List;

public class EventSource<E, L extends EventListener<E>> {

	private List<L> listeners = new ArrayList<L>();
	
	public void fire(E event) {
		for(L listener : listeners) {
			listener.onEvent(event);
		}
	}

	public void register(L listener) {
		listeners.add(listener);
	}
}
